//
//  UIViewController+bd_present.m
//  AipOcrDemo
//
//  Created by Zhang,Jian(MBD) on 2021/12/14.
//  Copyright © 2021 Baidu. All rights reserved.
//

#import "UIViewController+HHExtension.h"

@implementation UIViewController (HHExtension)

- (void)hh_presentViewControllerWithFullScreen:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion {
    viewControllerToPresent.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:viewControllerToPresent animated:flag completion:completion];
}

- (void)hh_popToViewController:(NSString *)viewControllerName
{
    UIViewController *resultVC = nil;
    for (UIViewController *vc in self.navigationController.viewControllers) {
        if ([vc isKindOfClass:NSClassFromString(viewControllerName)]) {
            resultVC = vc;
            break;
        }
    }
    
    if(resultVC)
    {
        [self.navigationController popToViewController:resultVC animated:YES];
    }else
    {
        [self.navigationController popViewControllerAnimated:YES];
    }
}
@end
